package com.kobe.algorithm.leetcode.case9;

/**
 * @author ：caopengfei
 * @date ：2021/3/27
 */
public class Solution {

    public static void main(String[] args) {


        Solution solution = new Solution();
        System.out.println(solution.isPalindrome(122210));
    }

    public boolean isPalindrome(int x) {
          if(x < 0){
              return false;
          }
          int xOver =  overturn(x,0);
          return  x == xOver;
    }

    private   int  overturn(int x,int result){
        if(x < 10){
            return result+x;
        }
        int mod = x % 10;
        x = x/10;
        result = (result+mod)*10;
        return overturn(x,result);
    }

}
